<?php
/**
 * Created by PhpStorm.
 * User: Orange
 * Date: 2018/4/26
 * Time: 14:21
 */

namespace app\admin\controller;

use app\common\controller\Backend;

class Add extends Backend
{
    protected $model = null;

    public function addUser()
    {
        $data = array('nickname' => 'nick2', 'user_type' => 0, 'create_time' => time());
        $result = model('User')->create($data);
        var_dump($result['id']);
    }

    public function addAccessLog()
    {
        $data = array('keyword' => '苏打水', 'ip' => '123.232.231.31', 'create_time' => time(), 'search_type' => '0', 'member_id' => 6);
        $result = model('AccessLog')->create($data);
        var_dump($result['id']);
    }

    public function addLoginLog()
    {
        $data = array('ip' => '123.232.231.31', 'create_time' => time(), 'member_id' => 5);
        $result = model('LoginLog')->create($data);
        var_dump($result['id']);
    }

    public function addVerify()
    {
        $data = array('status' => '0', 'create_time' => time(), 'member_id' => 6, 'bacteria_id' => 1, 'type' => 1);
        $result = model('VerifyLog')->create($data);
        var_dump($result['id']);
    }

    public function addBacteria()
    {
        $result1 = model('Bacteria')->select();
        var_dump($result1);
    }

    public function findBacteriaCategory()
    {
        $categoryData = model('BacteriaCategory')->where(array('bacteria_id' => 8))->select();
        echo "<pre>";print_r( $categoryData);echo "<pre>";
    }
    public function update1()
    {
//       model('User')->where(array('id' => 31))->update(array('user_type'=>0));
        $user_id = model('Member')->where(array('id' => 26))->value('user_id');
       var_dump($user_id);
    }
}